# Maintainer: Justin Kromlinger <hashworks@archlinux.org>
pkgname=libkiwix
pkgver=12.1.1
pkgrel=1
pkgdesc="Library providing the Kiwix software core"
license=('GPL3')
arch=('loong64' 'x86_64')
provides=('kiwix-lib')
conflicts=('kiwix-lib')
replaces=('kiwix-lib')
depends=('libzim>=9.0.0' 'pugixml' 'xapian-core' 'aria2' 'libmicrohttpd' 'python' 'curl')
makedepends=('meson' 'gtest' 'mustache')
url='https://github.com/kiwix/libkiwix'
source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/${pkgver}.tar.gz")
sha256sums=('8db344952d91c7b6d1b0fb4893f50bb6fa78c0e88506a5b507c7e179611d6cb1')

build() {
	cd "${pkgname}-${pkgver}"
	# We want to ignore xapian ABI version mismatches
	# https://github.com/openzim/libzim/issues/757
	arch-meson build -Dwerror=false -Dcpp_std=c++17
	ninja -C build
}

check() {
	cd "${pkgname}-${pkgver}/build"
	meson test
}

package() {
	install -Dm644 "${pkgname}-${pkgver}/COPYING" "$pkgdir/usr/share/licenses/$pkgname/COPYING"
	cd "${pkgname}-${pkgver}/build"
	DESTDIR="${pkgdir}" ninja install
}
